#include "Sheet.h"

#include <vector>

class SheetImpl;
class CellImpl;
typedef std::vector<Cell*>::iterator CVIter;

class CellIterImpl : public CellIter
{
public:
	CellIterImpl(CVIter cur, CVIter end);
	CellIterImpl(CVIter end);
	virtual bool Next();
	virtual void Release();
	virtual Cell* GetCell();

	virtual bool operator==(const CellIter& rhs);
	virtual bool operator!=(const CellIter& rhs);

private:
	CVIter m_iterCur;
	CVIter m_iterEnd;
};

class EntryImpl : public Entry
{
public:
	EntryImpl(SheetImpl* sheet, const char* memdata, int size);
	~EntryImpl();

	virtual Cell*	GetCell(int column);
	virtual Cell*	GetCell(const char* title);
	virtual Cell*	GetIDCell();
	virtual Sheet*	GetSheet();
	virtual int		GetID();

	virtual CellIter*	GetFirst();
	virtual CellIter*	GetLast();

	int	GetColumn(CellImpl* cell);
	bool IsLoaded();
private:
	bool ParseEntryData(const char* memdata, int size);
	bool ParseEntryCell(int column, const char* memdata, int size);
	
	SheetImpl* m_sheet;
	bool m_isLoaded;

	
	std::vector<Cell*> m_cells;
};
